import Vue from "vue";
import { Tooltip } from "element-ui";

const JuTooltip = (options: any) => {
  const instance: any = new Tooltip();
  instance.left = options.left;
  instance.top = options.top;
  instance.menuItems = options.menuItems;
  // popup 中的属性
  // instance.lockScroll = true; // 锁定滚动条
  // instance.modal = true;// 模态框，有遮罩
  // instance.modalAppendToBody = true;// 模态框插入到body 中
  instance.$mount();

  document.body.appendChild(instance.$el);

  Vue.nextTick(() => {
    instance.visible = true;
  });

  return instance;
};

JuTooltip.show = (options: any) => JuTooltip(options);

export default JuTooltip;
